/*
 * bmpTest.c
 *
 *  Created on: May 21, 2013
 *      Author: koldar
 */

#include <stdio.h>
#include <stdlib.h>
#include "bmp-tools.h"
#include "main-tools.h"

#define W 150
#define H 150

int main(int argn, const char** args){
	FILE* f;

	if (argn==2){
		f=fopen(args[1],"w");
	}else{
		printf("numero di parametri passati errati.\n");
		return EXIT_FAILURE;
	}
	writeHeaderInFile(f,H,W);
	Pimage img=initImage(W,H);
	int i=0;
	int j=0;

	fillColor(img,getRGB(255,255,255));

	setPixelInImage(img,0,0,getRGB(255,0,0));

	setPixelInImage(img,0,11,getRGB(0,0,255));
	setPixelInImage(img,0,12,getRGB(0,0,255));
	setPixelInImage(img,1,11,getRGB(0,0,255));
	setPixelInImage(img,1,12,getRGB(0,0,255));


	drawLine(img,50,50,70,70,5,getRGB(0,255,0));
	drawLine(img,70,50,70,70,5,getRGB(0,0,255));
	drawLine(img,90,50,70,70,5,getRGB(0,0,255));
	drawLine(img,50,50,70,50,5,getRGB(0,0,255));
	drawLine(img,50,90,70,70,5,getRGB(0,0,255));
	drawLine(img,70,90,70,70,5,getRGB(0,0,255));
	drawLine(img,90,90,70,70,5,getRGB(0,0,255));

	applyImageToFile(img,f);

	free(img);
	fclose(f);
	printf("FINE.\n");
}
